package com.gali.mall.service.impl;

import com.gali.mall.model.dao.OrderItemMapper;
import com.gali.mall.model.pojo.OrderItem;
import com.gali.mall.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author gali
 * @date 2022/4/25 21:25
 */
@Service
public class OrderItemServiceImpl implements OrderItemService {
    @Autowired
    private OrderItemMapper orderItemMapper;
    /**
     * 添加订单
     *
     * @param orderItem
     * @return
     */
    @Override
    public boolean addOrderItem(OrderItem orderItem) {
        return orderItemMapper.insertSelective(orderItem)>0;
    }

    /**
     * 删除订单
     *
     * @param id
     * @return
     */
    @Override
    public boolean deleteOrderItem(Integer id) {
        return orderItemMapper.deleteByPrimaryKey(id)>0;
    }

    /**
     * 更新订单
     *
     * @param orderItem
     * @return
     */
    @Override
    public boolean reviseOrderItem(OrderItem orderItem) {
        return orderItemMapper.updateByPrimaryKeySelective(orderItem)>0;
    }

    /**
     * 查询订单
     *
     * @param id
     * @return
     */
    @Override
    public OrderItem selectOrderItem(Integer id) {
        return orderItemMapper.selectByPrimaryKey(id);
    }
}
